﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using System.Security.Permissions;

namespace 旅游管理系统.Models
{
    /// <summary>
    /// 旅游路线类
    /// </summary>
    public class TouristRoute
    {
        /// <summary>
        /// Guid 类型：在数据中作为唯一标识类型
        /// </summary>
        [Key]
        public Guid Id { get; set; }
        /// <summary>
        /// 名称或标题
        /// </summary>
        [Required] //不能为空
        [MaxLength(100)] //限长
        public string Title { get; set; }
        /// <summary>
        /// 描述、说明
        /// </summary>
        [Required]
        [MaxLength(1500)]
        public string Description { get; set; }
        /// <summary>
        /// 原价
        /// </summary>
        [Column(TypeName = "decimal(18,2)")] //以四舍五入的形式保存两位小数，若小数位没有值时则补18个0
        public decimal OriginalPrice { get; set; }
        /// <summary>
        /// 折扣  百分比的形式存储在数据库中
        /// </summary>
        [Range(0.0, 1.0)]
        public double? DiscountPresent { get; set; } //可控字段：指用户可填可不填，
        /// <summary>
        /// 发布时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        public DateTime? UpdateTime { get; set; }
        /// <summary>
        /// 出发时间
        /// </summary>
        public DateTime? DepartureTime { get; set; }
        /// <summary>
        /// 买点介绍
        /// </summary>
        [MaxLength]
        public string Features { get; set; }
        /// <summary>
        /// 费用说明
        /// </summary>
        [MaxLength]
        public string Fees { get; set; }
        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength]
        public string Notes { get; set; }
        /// <summary>
        /// 与 TouristRoutePicture类中相应的外键关系，图片列表信息
        /// </summary>
        public ICollection<TouristRoutePicture> TouristRoutePictures { get; set; } //一个旅游路线可以有许多张图片，为一对多的关系，应写成数组的形式。 使用 ICollection<类型> 类型
              = new List<TouristRoutePicture>();  //让代码更健壮，避免未知的错误 
        /// <summary>
        /// 评分
        /// </summary>
        public double? Rating { get; set; }
        /// <summary>
        /// 旅游天数
        /// </summary>
        public TravelDays? TravelDays { get; set; }
        /// <summary>
        /// 旅游类型
        /// </summary>
        public TripType? TripType { get; set; }
        /// <summary>
        /// 出发地
        /// </summary>
        public DepartureCity? DepartureCity { get; set;}
    }
}
